<?php
    include_once 'fun.php';
    include_once 'islogin.php';
    $_SESSION['isadmin']=isset($_SESSION['isadmin'])?$_SESSION['isadmin']:'';
  if ($_SESSION['isadmin']!=0&&$_SESSION['isadmin']!=-1) {
      header('Refresh:1;url=shop.php');
      die("请以销售身份登录");
  }
    $id=$_GET['id'];
    $con=connect();
    $sql = "update counter set productid = null  where productid=$id";
    query($sql,$con);
    $sql = "update product set stocknum = stocknum+counternum where productid=$id";
    query($sql,$con);
    $sql = "update product set counternum = 0 where productid=$id";
    query($sql,$con);
    echo "<script>
			location.href='sell.php';
	</script>";
?>